A5_ADOImportTable Function
Syntax
Arguments
- Result
A dot variable containing the following elements.
- Element
Description
- Error
A logical result flag.
- ErrorText
A character message returned by the ADO database or the script.
- Script
The script that generated the result table.
- ConnectionString
The connection string required to establish a connection to the database.
- TableOrSQL
The name of the ADO database table to open or the SQL SELECT statement that retrieves the data.
- DBFTableName
The path and name of the table to create.
- Fields
Optional. Default = "". A comma delimited list of fields to retrieve or empty string for all fields.
- Username
Optional. Default = "". The user name required to log on to the database.
- Password
Optional. Default = "". The password required to log on to the database.
- lSilent
Optional. Default = .F. (False). When set to .T. (True), the function will not display errors or prompts, such as "Overwrite existing table?". Logical
- lBatch
Logical. Optional. Default = .F. (False).
- lOverwrite
Logical. Optional. Default = .F. (False). When set to .T. (True), the function overwrites existing tables without prompting. When set to .F. (False), and Silent is .T., the function will not import the table is the result table already exists.
- SizeToFit
Logical. Optional. Default = .F. (False). After importing, resize the fields in the result table to be as small as possible. For example, if a field has a length of 50, but the longest item in this field is only 10 characters, the field length will be adjusted to 10 plus a 2 character pad.
- TimeAsDate
Optional. Default = .F. (False). By default, the function imports Date/Time fields as Time (T) fields. When set to .T. (True), the function imports these fields as date (D) fields. Logical
- cArgs
Optional. Default = "". Arguments for a dialog box. Refer to the Xbasic code generated by A5_ADOImportTable() for an example.
- flagForceSQL
Logical
Description
Import an ADO Table. Fields is a comma delimited list of fields or empty string for all fields.
Discussion
The A5_ADOImportTable() function retrieves data from an ADO compatible database or Excel spreadsheet and creates an Alpha Anywhere table.
Example
pImportResult = A5_ADOImportTable("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\A5V7\MDBFiles\Alphasports.mdb;Persist", "Customer", "C:\Program Files\A5V7\new_customer.dbf", "COMPANY,FIRSTNAME,LASTNAME", "", "", .t., .f., .t., .t., .f., "")
This example uses variables.
dim ss as C = "C:\Customer.xls" dim tt as C = "c6.dbf" dim cs as C dim sn as C = "Customer" dim fl as C = "CUSTOMER_ID,LASTNAME,FIRSTNAME,COMPANY,PHONE,FAX" cs = a5_excelconnstring(ss) pImportResult = A5_ADOImportTable(cs, sn +"$", tt, fl, "", "", .f., .f., .f., .t., .f., "")
See Also